//
//  HeartXAxisValueFormatter.swift
//  DaRings
//
//  Created by 尹琼 on 2023/2/17.
//

import UIKit
import Charts

open class HeartWeekAxisValueFormatter: NSObject, IAxisValueFormatter {
    
    private var dataCount: Int
    
    public var axisValueArray : [String] = []
     
    public func stringForValue(_ value: Double, axis: AxisBase?) -> String {
        
        let index = Int(value)
       
        if axisValueArray.isEmpty || dataCount == 0 {
            return ""
        }
        let space = dataCount/axisValueArray.count
        
        let i = index/space
        
        return "\(axisValueArray[i])"
        
    }
    
    public init(dataCount: Int) {
        
        self.dataCount = dataCount
        super.init()
        
    }

}
